﻿
namespace ATA.Windows.Forms
{
	/// <summary>
	/// abstract DoanhSo typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class DoanhSoDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<DoanhSoDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.DoanhSo _currentDoanhSo = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxDoanhSoDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxDoanhSoErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxDoanhSoBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the Id property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIdDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the SoHoaDon property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxSoHoaDonDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the NgayLayHang property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNgayLayHangDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the KhachHangId property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxKhachHangIdDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the InventoryItemId property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxInventoryItemIdDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the SoLuong property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxSoLuongDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DonGia property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDonGiaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThanhTien property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThanhTienDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the GhiChu property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxGhiChuDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.KhachHang> _KhachHangIdList;
		
		/// <summary> 
		/// The list of selectable KhachHang
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.KhachHang> KhachHangIdList
		{
			get {return this._KhachHangIdList;}
			set 
			{
				this._KhachHangIdList = value;
				this.uxKhachHangIdDataGridViewColumn.DataSource = null;
				this.uxKhachHangIdDataGridViewColumn.DataSource = this._KhachHangIdList;
			}
		}
		
		private bool _allowNewItemInKhachHangIdList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of KhachHang
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInKhachHangIdList
		{
			get { return _allowNewItemInKhachHangIdList;}
			set
			{
				this._allowNewItemInKhachHangIdList = value;
				this.uxKhachHangIdDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.DoanhSo> _DoanhSoList;
				
		/// <summary> 
		/// The list of DoanhSo to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.DoanhSo> DoanhSoList
		{
			get {return this._DoanhSoList;}
			set
			{
				this._DoanhSoList = value;
				this.uxDoanhSoBindingSource.DataSource = null;
				this.uxDoanhSoBindingSource.DataSource = value;
				this.uxDoanhSoDataGridView.DataSource = null;
				this.uxDoanhSoDataGridView.DataSource = this.uxDoanhSoBindingSource;				
				//this.uxDoanhSoBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxDoanhSoBindingSource_ListChanged);
				this.uxDoanhSoBindingSource.CurrentItemChanged += new System.EventHandler(OnDoanhSoBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnDoanhSoBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentDoanhSo = uxDoanhSoBindingSource.Current as Entities.DoanhSo;
			
			if (_currentDoanhSo != null)
			{
				_currentDoanhSo.Validate();
			}
			//_DoanhSo.Validate();
			OnCurrentEntityChanged();
		}

		//void uxDoanhSoBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.DoanhSo"/> instance.
		/// </summary>
		public Entities.DoanhSo SelectedDoanhSo
		{
			get {return this._currentDoanhSo;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxDoanhSoDataGridView.VirtualMode;}
			set
			{
				this.uxDoanhSoDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxDoanhSoDataGridView.AllowUserToAddRows;}
			set {this.uxDoanhSoDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxDoanhSoDataGridView.AllowUserToDeleteRows;}
			set {this.uxDoanhSoDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxDoanhSoDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxDoanhSoDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="DoanhSoDataGridViewBase"/> class.
		/// </summary>
		public DoanhSoDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxDoanhSoDataGridView = new System.Windows.Forms.DataGridView();
			this.uxDoanhSoBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxDoanhSoErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIdDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxSoHoaDonDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNgayLayHangDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxKhachHangIdDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxInventoryItemIdDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxSoLuongDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDonGiaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxThanhTienDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxGhiChuDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxKhachHangIdBindingSource = new KhachHangBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxKhachHangIdBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDoanhSoDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDoanhSoBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDoanhSoErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxDoanhSoErrorProvider
			// 
			this.uxDoanhSoErrorProvider.ContainerControl = this;
			this.uxDoanhSoErrorProvider.DataSource = this.uxDoanhSoBindingSource;						
			// 
			// uxDoanhSoDataGridView
			// 
			this.uxDoanhSoDataGridView.AutoGenerateColumns = false;
			this.uxDoanhSoDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxDoanhSoDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIdDataGridViewColumn,
		this.uxSoHoaDonDataGridViewColumn,
		this.uxNgayLayHangDataGridViewColumn,
		this.uxKhachHangIdDataGridViewColumn,
		this.uxInventoryItemIdDataGridViewColumn,
		this.uxSoLuongDataGridViewColumn,
		this.uxDonGiaDataGridViewColumn,
		this.uxThanhTienDataGridViewColumn,
		this.uxGhiChuDataGridViewColumn			});
			this.uxDoanhSoDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxDoanhSoDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxDoanhSoDataGridView.Name = "uxDoanhSoDataGridView";
			this.uxDoanhSoDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxDoanhSoDataGridView.TabIndex = 0;	
			this.uxDoanhSoDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxDoanhSoDataGridView.EnableHeadersVisualStyles = false;
			this.uxDoanhSoDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnDoanhSoDataGridViewDataError);
			this.uxDoanhSoDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnDoanhSoDataGridViewCellValueNeeded);
			this.uxDoanhSoDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnDoanhSoDataGridViewCellValuePushed);
			
			//
			// uxIdDataGridViewColumn
			//
			this.uxIdDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIdDataGridViewColumn.DataPropertyName = "Id";
			this.uxIdDataGridViewColumn.HeaderText = "Id";
			this.uxIdDataGridViewColumn.Name = "uxIdDataGridViewColumn";
			this.uxIdDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIdDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIdDataGridViewColumn.ReadOnly = true;		
			//
			// uxSoHoaDonDataGridViewColumn
			//
			this.uxSoHoaDonDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxSoHoaDonDataGridViewColumn.DataPropertyName = "SoHoaDon";
			this.uxSoHoaDonDataGridViewColumn.HeaderText = "SoHoaDon";
			this.uxSoHoaDonDataGridViewColumn.Name = "uxSoHoaDonDataGridViewColumn";
			this.uxSoHoaDonDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxSoHoaDonDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxSoHoaDonDataGridViewColumn.ReadOnly = false;		
			//
			// uxNgayLayHangDataGridViewColumn
			//
			this.uxNgayLayHangDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNgayLayHangDataGridViewColumn.DataPropertyName = "NgayLayHang";
			this.uxNgayLayHangDataGridViewColumn.HeaderText = "NgayLayHang";
			this.uxNgayLayHangDataGridViewColumn.Name = "uxNgayLayHangDataGridViewColumn";
			this.uxNgayLayHangDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNgayLayHangDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNgayLayHangDataGridViewColumn.ReadOnly = false;		
			//
			// uxKhachHangIdDataGridViewColumn
			//
			this.uxKhachHangIdDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxKhachHangIdDataGridViewColumn.DataPropertyName = "KhachHangId";
			this.uxKhachHangIdDataGridViewColumn.HeaderText = "KhachHangId";
			this.uxKhachHangIdDataGridViewColumn.Name = "uxKhachHangIdDataGridViewColumn";
			this.uxKhachHangIdDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxKhachHangIdDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxKhachHangIdDataGridViewColumn.ReadOnly = false;		
			//
			// uxInventoryItemIdDataGridViewColumn
			//
			this.uxInventoryItemIdDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxInventoryItemIdDataGridViewColumn.DataPropertyName = "InventoryItemId";
			this.uxInventoryItemIdDataGridViewColumn.HeaderText = "InventoryItemId";
			this.uxInventoryItemIdDataGridViewColumn.Name = "uxInventoryItemIdDataGridViewColumn";
			this.uxInventoryItemIdDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxInventoryItemIdDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxInventoryItemIdDataGridViewColumn.ReadOnly = false;		
			//
			// uxSoLuongDataGridViewColumn
			//
			this.uxSoLuongDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxSoLuongDataGridViewColumn.DataPropertyName = "SoLuong";
			this.uxSoLuongDataGridViewColumn.HeaderText = "SoLuong";
			this.uxSoLuongDataGridViewColumn.Name = "uxSoLuongDataGridViewColumn";
			this.uxSoLuongDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxSoLuongDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxSoLuongDataGridViewColumn.ReadOnly = false;		
			//
			// uxDonGiaDataGridViewColumn
			//
			this.uxDonGiaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDonGiaDataGridViewColumn.DataPropertyName = "DonGia";
			this.uxDonGiaDataGridViewColumn.HeaderText = "DonGia";
			this.uxDonGiaDataGridViewColumn.Name = "uxDonGiaDataGridViewColumn";
			this.uxDonGiaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDonGiaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDonGiaDataGridViewColumn.ReadOnly = false;		
			//
			// uxThanhTienDataGridViewColumn
			//
			this.uxThanhTienDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThanhTienDataGridViewColumn.DataPropertyName = "ThanhTien";
			this.uxThanhTienDataGridViewColumn.HeaderText = "ThanhTien";
			this.uxThanhTienDataGridViewColumn.Name = "uxThanhTienDataGridViewColumn";
			this.uxThanhTienDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThanhTienDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThanhTienDataGridViewColumn.ReadOnly = false;		
			//
			// uxGhiChuDataGridViewColumn
			//
			this.uxGhiChuDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxGhiChuDataGridViewColumn.DataPropertyName = "GhiChu";
			this.uxGhiChuDataGridViewColumn.HeaderText = "GhiChu";
			this.uxGhiChuDataGridViewColumn.Name = "uxGhiChuDataGridViewColumn";
			this.uxGhiChuDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxGhiChuDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxGhiChuDataGridViewColumn.ReadOnly = false;		
			//
			// uxKhachHangIdDataGridViewColumn
			//				
			this.uxKhachHangIdDataGridViewColumn.DisplayMember = "TenKh";	
			this.uxKhachHangIdDataGridViewColumn.ValueMember = "KhachHangId";	
			this.uxKhachHangIdDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxKhachHangIdDataGridViewColumn.DataSource = uxKhachHangIdBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxDoanhSoDataGridView);
			this.Name = "DoanhSoDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxKhachHangIdBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDoanhSoErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDoanhSoDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDoanhSoBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				DoanhSoDataGridViewEventArgs args = new DoanhSoDataGridViewEventArgs();
				args.DoanhSo = _currentDoanhSo;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class DoanhSoDataGridViewEventArgs : System.EventArgs
		{
			private Entities.DoanhSo	_DoanhSo;
	
			/// <summary>
			/// the  Entities.DoanhSo instance.
			/// </summary>
			public Entities.DoanhSo DoanhSo
			{
				get { return _DoanhSo; }
				set { _DoanhSo = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxDoanhSoDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnDoanhSoDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxDoanhSoDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnDoanhSoDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxDoanhSoDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIdDataGridViewColumn":
						e.Value = DoanhSoList[e.RowIndex].Id;
						break;
					case "uxSoHoaDonDataGridViewColumn":
						e.Value = DoanhSoList[e.RowIndex].SoHoaDon;
						break;
					case "uxNgayLayHangDataGridViewColumn":
						e.Value = DoanhSoList[e.RowIndex].NgayLayHang;
						break;
					case "uxKhachHangIdDataGridViewColumn":
						e.Value = DoanhSoList[e.RowIndex].KhachHangId;
						break;
					case "uxInventoryItemIdDataGridViewColumn":
						e.Value = DoanhSoList[e.RowIndex].InventoryItemId;
						break;
					case "uxSoLuongDataGridViewColumn":
						e.Value = DoanhSoList[e.RowIndex].SoLuong;
						break;
					case "uxDonGiaDataGridViewColumn":
						e.Value = DoanhSoList[e.RowIndex].DonGia;
						break;
					case "uxThanhTienDataGridViewColumn":
						e.Value = DoanhSoList[e.RowIndex].ThanhTien;
						break;
					case "uxGhiChuDataGridViewColumn":
						e.Value = DoanhSoList[e.RowIndex].GhiChu;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxDoanhSoDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnDoanhSoDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxDoanhSoDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIdDataGridViewColumn":
						DoanhSoList[e.RowIndex].Id = (System.Int32)e.Value;
						break;
					case "uxSoHoaDonDataGridViewColumn":
						DoanhSoList[e.RowIndex].SoHoaDon = (System.String)e.Value;
						break;
					case "uxNgayLayHangDataGridViewColumn":
						DoanhSoList[e.RowIndex].NgayLayHang = (System.DateTime?)e.Value;
						break;
					case "uxKhachHangIdDataGridViewColumn":
						DoanhSoList[e.RowIndex].KhachHangId = (System.Guid?)e.Value;
						break;
					case "uxInventoryItemIdDataGridViewColumn":
						DoanhSoList[e.RowIndex].InventoryItemId = (System.Guid?)e.Value;
						break;
					case "uxSoLuongDataGridViewColumn":
						DoanhSoList[e.RowIndex].SoLuong = (System.Int32?)e.Value;
						break;
					case "uxDonGiaDataGridViewColumn":
						DoanhSoList[e.RowIndex].DonGia = (System.Decimal?)e.Value;
						break;
					case "uxThanhTienDataGridViewColumn":
						DoanhSoList[e.RowIndex].ThanhTien = (System.Decimal?)e.Value;
						break;
					case "uxGhiChuDataGridViewColumn":
						DoanhSoList[e.RowIndex].GhiChu = (System.String)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
